/**
 * 
 */
package com.thor.palmmall.rest.order.converter;

import java.util.ArrayList;

import org.springframework.core.convert.converter.Converter;

import com.thor.palmmall.rest.order.AProductPromParam;
import com.thor.palmmall.rest.statement.ABuildingsParam;
import com.thor.palmmall.spi.basic.SBuildingsParam;
import com.thor.palmmall.spi.order.SProductPromParam;

/**
 * @author NuoSa
 *
 * @since 1.0
 */
public class SProductPromParamConverter implements Converter<AProductPromParam, SProductPromParam> {
  public static SProductPromParamConverter getInstance() {
    if (instance == null)
      instance = new SProductPromParamConverter();
    return instance;
  }

  private static SProductPromParamConverter instance;

  private SProductPromParamConverter() {
  }

  @Override
  public SProductPromParam convert(AProductPromParam source) {
    if (source == null) {
      return null;
    }
    SProductPromParam target = new SProductPromParam();
    target.setContracts(new ArrayList<String>());
    target.getContracts().addAll(source.getContracts());
    return target;
  }

}
